<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$router->get('/', function () use ($router) {
    return $router->app->version();
});


// 后台公共权限接口
$router->group([
    // 路由中间件
    'middleware' => ['center_login_auth', 'admin_request_log', 'access_control_allow_origin'],
    // 前缀
    'prefix' => 'admin'
], function () use ($router) {
    // 站内信
    $router->group(['prefix' => 'letter'], function () use ($router) {
        $router->post('select', 'Admin\LetterController@select');
        $router->post('read', 'Admin\LetterController@read');
    });
});


// 前台接口
$router->group([
    // 路由前缀
    'prefix' => 'front',
    // 路由中间件
    'middleware' => ['api_sign_valid', 'access_control_allow_origin']
], function () use ($router) {
    // 消息
    $router->group(['prefix' => 'message'], function () use ($router) {
        // 飞书
        $router->post('feishu', 'Front\MessageController@feishu');

        // 阿里短信
        $router->post('alisms_captcha', 'Front\MessageController@alismsCaptcha');
    });

    // 站内信
    $router->group(['prefix' => 'letter'], function () use ($router) {
        $router->post('create', 'Front\LetterController@create');
    });
});
